home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / inet / ien / ien-166 < prev    next >
Text File  |  1988-12-01  |  45KB  |  1,709 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.                   DESIGN OF TCP/IP FOR THE TAC
  15.  
  16.  
  17.                              IEN-166
  18.  
  19.                           Robert Hinden
  20.  
  21.                   Bolt Beranek and Newman Inc.
  22.  
  23.                           January 1981
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.                                     
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60. IEN-166                                                 R. Hinden
  61.                                      Bolt Beranek and Newman Inc.
  62.                                                      January 1981
  63.  
  64.  
  65.  
  66.                         Table of Contents
  67.  
  68.  
  69. 1   Introduction.......................................... 1
  70. 2   Overall Data Flow..................................... 2
  71. 2.1   Receiving Data...................................... 2
  72. 2.1.1   1822 Module....................................... 3
  73. 2.1.2   NCP Module........................................ 4
  74. 2.1.3   Internet Module................................... 4
  75. 2.1.4   TCP Module........................................ 5
  76. 2.1.5   Telnet Module..................................... 6
  77. 2.2   Sending Data........................................ 7
  78. 2.2.1   Telnet Module..................................... 7
  79. 2.2.2   TCP Module........................................ 8
  80. 2.2.3   Internet Module................................... 9
  81. 2.2.4   1822 Module....................................... 9
  82. 3   Control and Priority................................. 10
  83. 4   Data Structures...................................... 11
  84. 4.1   Message Block...................................... 11
  85. 4.2   Protocol Data Block................................ 13
  86. 5   1822 Protocol........................................ 16
  87. 6   Internet Protocol.................................... 17
  88. 6.1   Identifier Assignment.............................. 17
  89. 6.2   Option Support..................................... 17
  90. 6.3   Reassembly......................................... 17
  91. 6.4   Routing............................................ 19
  92. 6.5   Gateway to Gateway Messages........................ 20
  93. 6.6   Timeouts........................................... 21
  94. 7   Transmission Control Protocol........................ 21
  95. 7.1   Connection Opening and Closing..................... 21
  96. 7.2   Initial Sequence Number Assignment................. 22
  97. 7.3   Option Support..................................... 22
  98. 7.4   Urgent Data........................................ 23
  99. 7.5   End of Letter Handling............................. 23
  100. 7.6   Retransmissions.................................... 24
  101. 7.7   Acknowledgement and Window Strategy................ 24
  102. 7.8   Sequencing......................................... 25
  103.  
  104.  
  105.  
  106.                              FIGURES
  107.  
  108.  
  109. Data and Control Flow..................................... 3
  110. Message Block Format..................................... 12
  111. Protocol Data Block Format............................... 15
  112.  
  113.  
  114.  
  115.  
  116.  
  117.                                -i-
  118.  
  119. IEN-166                                                 R. Hinden
  120.                            Bolt Beranek and Newman Inc.
  121.                                    January 1981
  122.  
  123.  
  124.                   Design of TCP/IP for the TAC
  125.  
  126.  
  127. 1.  Introduction
  128.  
  129.  
  130.      This  document  is  a  working  design  document   for   the
  131.  
  132. development  of  the  Transmission  Control  Protocol  (TCP)  and
  133.  
  134. Internet Protocol (IP) for the Terminal Access Controller  (TAC).
  135.  
  136. The  TAC  is  a terminal controller that supports the TCP and NCP
  137.  
  138. host to host protocols.  It will run in an H-316 computer with  a
  139.  
  140. Multi-Line  Terminal Controller (MLC) and an 1822 host interface.
  141.  
  142. It is based in part on the existing H-316 TIP.
  143.  
  144.  
  145.      This document is meant as a guide for the implementation  of
  146.  
  147. the  TAC.   The  intent  is  not  to  write  a specification that
  148.  
  149. describes everything in fine detail, but to describe the  overall
  150.  
  151. system  and  how  its  pieces interact with each other.  Also, it
  152.  
  153. discusses changes to parts of the existing H-316 TIP.
  154.  
  155.  
  156.      Everything in this document is subject to  change.   As  the
  157.  
  158. implementation and debugging proceed, new things will be learned.
  159.  
  160. This will force a re-evaluation  of  the  design  decisions  made
  161.  
  162. here.  Undoubtedly, some things will change.
  163.  
  164.  
  165.      The document is written assuming a working knowledge of  the
  166.  
  167. 316  TIP,  Internet  Protocol, Transmission Control Protocol, and
  168.  
  169. Network Control Protocol.  All numbers in this  document  are  in
  170.  
  171. decimal.
  172.  
  173.  
  174.  
  175.                                -1-
  176.  
  177. IEN-166                                                 R. Hinden
  178.                                      Bolt Beranek and Newman Inc.
  179.                                                      January 1981
  180.  
  181.  
  182.  
  183. 2.  Overall Data Flow
  184.  
  185.  
  186.      A basic premise in the design of TAC is that data should not
  187.  
  188. be  moved between buffers, rather the pointers to the data should
  189.  
  190. be passed between program modules.  Thus, when a message is  read
  191.  
  192. into  a  buffer,  pointers to it are passed between the different
  193.  
  194. protocol modules.  When a character is read from the MLC and  put
  195.  
  196. into  a  buffer,  the  protocol  modules  manipulate  the  buffer
  197.  
  198. pointers, not the data itself.  This is illustrated in Figure 1.
  199.  
  200.  
  201.  
  202.  
  203. 2.1  Receiving Data
  204.  
  205.  
  206.      To receive data from the network,  a message  is  read  from
  207.  
  208. the  1822  host  interface  into  a Message Block (MBLK).  If the
  209.  
  210. message will not fit in one MBLK, the remainder will be read into
  211.  
  212. other  free MBLKs until the message has been completely read in.
  213.  
  214. All  the  MBLKs  containing  the  same  message  will  be  linked
  215.  
  216. together.   A  Protocol Data Block (PDB) will be created to point
  217.  
  218. to the MBLKs.  The pointers that are passed between the  protocol
  219.  
  220. modules  will  point  to  the PDBs.  More details on the PDBs and
  221.  
  222. MBLKs can be found in the section on "Data Structures".
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.                                -2-
  234.  
  235. IEN-166                                                 R. Hinden
  236.                                      Bolt Beranek and Newman Inc.
  237.                                                      January 1981
  238.  
  239.  
  240.  
  241.  
  242.  
  243.                           +---------+
  244.                           +         +
  245.          +--------------- + Message + <-------------------+
  246.          |+-------------- + Buffers + <------------------+ \
  247.          ||               +         +                     \ \
  248.          VV               +---------+                      \ \
  249.         +---+                                               \ \
  250.    +--- +   + Tumble                                         \ \
  251.    |+-- +   + Table         +-----+    +----+                 \ \
  252.    ||   +---+               |     |    |    |                  \ \
  253.    ||                     +>| TCP |<-->| IP |<-+                \ \
  254.    VV         +--------+  | |     |    |    |  |   +------+      \ \
  255.  +++++++      |        |  | +-----+    +----+  |   |      |    +++++++
  256.  | MLC |<---->| Telnet |<-+                    +-->| 1822 |<-->| IMP |
  257.  +++++++      |        |  | +-----+            |   |      |    +++++++
  258.    ||         +--------+  | |     |            |   +------+      /\/\
  259.    ||                     +>| NCP |<-----------+                 / /
  260.    ||   +---+               |     |                             / /
  261.    |+-->+   + Tumble        +-----+                            / /
  262.    +--->+   + Table                                           / /
  263.         +---+                                                / /
  264.           ||             +----------+                       / /
  265.           ||             +          +                      / /
  266.           |+-----------> + Message  + --------------------+ /
  267.           +------------> + Buffers  + ---------------------+
  268.                          +          +
  269.                          +----------+
  270.  
  271.  
  272.             Control ----->                    Data ----->
  273.                                                    ----->
  274.  
  275.                 Figure 1 . Data and Control Flow
  276.  
  277.  
  278. 2.1.1  1822 Module
  279.  
  280.  
  281.      The 1822 module is given a pointer to a  PDB.   This  module
  282.  
  283. will act directly on the message if it is an 1822 control message
  284.  
  285. (i.e., a RFNM).  It will update the appropriate data structure to
  286.  
  287. initiate  the  action  to  be taken.  If the PDB contains an 1822
  288.  
  289.  
  290.  
  291.  
  292.                                -3-
  293.  
  294. IEN-166                                                 R. Hinden
  295.                                      Bolt Beranek and Newman Inc.
  296.                                                      January 1981
  297.  
  298.  
  299.  
  300. data message, it will be passed on to the next  protocol  module.
  301.  
  302. Which  module is passed to depends on the Link number in the 1822
  303.  
  304. message.  The Link number is the upper 8 bits of the "Message ID"
  305.  
  306. field in the 1822 leader.  The Link number to protocol mapping is
  307.  
  308. as follows:
  309.  
  310.  
  311.  
  312.           Link #          Protocol
  313.  
  314.           0               NCP Control
  315.           2-71            NCP Data
  316.           155             Internet
  317.  
  318.  
  319.  
  320. 2.1.2  NCP Module
  321.  
  322.  
  323.      The NCP module implements the ARPANET  Host-Host  Protocol.
  324.  
  325. Its  function  is  essentially  identical to the H-316 TIP's NCP.
  326.  
  327. The only difference is that it will be modified to work with  the
  328.  
  329. new  PDB  and MBLK data structures.  This will be done with a new
  330.  
  331. interface and hopefully will have a small impact  on  efficiency.
  332.  
  333. When  the  NCP  module  is  done with a message, it will pass the
  334.  
  335. pointer to the PDB to the Telnet Module.
  336.  
  337.  
  338.  
  339.  
  340. 2.1.3  Internet Module
  341.  
  342.  
  343.      When the Internet Protocol (IP) module gets a pointer  to  a
  344.  
  345. PDB it first checks the checksum in the IP header and then checks
  346.  
  347. that the destination address is correct (it should be the address
  348.  
  349.  
  350.                                -4-
  351.  
  352.  
  353. IEN-166                                                 R. Hinden
  354.                                      Bolt Beranek and Newman Inc.
  355.                                                      January 1981
  356.  
  357.  
  358.  
  359. of  the  TAC running the code).  If either of these checks fails,
  360.  
  361. the datagram is discarded.  Also, if the destination address  was
  362.  
  363. incorrect  an  IP  error report will be sent to the source of the
  364.  
  365. datagram.  The next check is  whether  or  not  the  datagram  is
  366.  
  367. fragmented.   If  so, then the IP module will perform reassembly.
  368.  
  369. This  is  described  in  detail  in  the  section  on   "Internet
  370.  
  371. Protocol".   When  the IP module gets a complete datagram (either
  372.  
  373. received whole or reassembled) it will pass it  on  to  the  next
  374.  
  375. protocol  module.   Which  module it is depends on the "Protocol"
  376.  
  377. field in the Internet header.  If a datagram is  received  for  a
  378.  
  379. protocol  that  is  not supported, it will be discarded and an IP
  380.  
  381. error  report  sent  to  the  datagram  source.   The   protocols
  382.  
  383. supported are as follows:
  384.  
  385.           Protocol #      Protocol Name
  386.  
  387.           3               Gateway to Gateway Protocol
  388.           6               Transmission Control Protocol
  389.           71              Packet Core
  390.           20              TAC Monitoring
  391.  
  392.  
  393.  
  394. 2.1.4  TCP Module
  395.  
  396.  
  397.      When the Transmission Control Protocol (TCP) receives a  PDB
  398.  
  399. it  first  checks the checksum of the message and the validity of
  400.  
  401. the TCP header.  If the message that passes this check is  for  a
  402.  
  403. valid  connection,  and  its  sequence number is in the receiving
  404.  
  405. window, the TCP module will set it up for  the  open  connection.
  406.  
  407.  
  408.  
  409.  
  410.                                -5-
  411.  
  412. IEN-166                                                 R. Hinden
  413.                                      Bolt Beranek and Newman Inc.
  414.                                                      January 1981
  415.  
  416.  
  417.  
  418. The  data  will be sequenced if necessary at this point.  This is
  419.  
  420. described in detail in the section on the  "Transmission  Control
  421.  
  422. Protocol".   The  next module is then informed that there is data
  423.  
  424. to be processed.
  425.  
  426.  
  427.      Flow control is implemented by using the TCP Acknowledgement
  428.  
  429. (ACK)  and  the  Window  size  parameters.   A  fixed  number  of
  430.  
  431. characters will be buffered for each connection.   As  characters
  432.  
  433. are  accepted they will be ACKed until the limitation is reached.
  434.  
  435. As  the  ACK  value  is  advanced,  the  window  will  be  shrunk
  436.  
  437. correspondingly.   When  the  next  module  takes  data  from the
  438.  
  439. message, buffer space becomes  available.   This  causes  TCP  to
  440.  
  441. advance  its  window, thus allowing the distant host to send more
  442.  
  443. data.
  444.  
  445.  
  446.      Normally the new ACK and window values will be sent out with
  447.  
  448. the  next  data  message  from  that  connection.   If nothing is
  449.  
  450. pending for this connection, a message with just the updated  ACK
  451.  
  452. and window values will be sent.  This is described in more detail
  453.  
  454. in the section "Transmission Control Protocol".
  455.  
  456.  
  457.  
  458.  
  459. 2.1.5  Telnet Module
  460.  
  461.  
  462.      The Telnet module is given a pointer to a PDB when there  is
  463.  
  464. data  to  be  processed.   This  data  may be from the NCP or TCP
  465.  
  466.  
  467.  
  468.  
  469.                                -6-
  470.  
  471. IEN-166                                                 R. Hinden
  472.                                      Bolt Beranek and Newman Inc.
  473.                                                      January 1981
  474.  
  475.  
  476.  
  477. protocol modules.  It takes characters out of  the  MBLKs,  looks
  478.  
  479. for Telnet commands, and outputs them to the MLC.  This output is
  480.  
  481. done using the existing TIP's "Tumble Tables".   This  will  work
  482.  
  483. using  "OIs",  which means that every time an "OI" comes in for a
  484.  
  485. port, Telnet will check if there is another character to output.
  486.  
  487.  
  488.  
  489.  
  490. 2.2  Sending Data
  491.  
  492.  
  493.      Data that is sent out to the network normally comes in  from
  494.  
  495. the  MLC  and  is  received  in "Tumble Table" format.  This is a
  496.  
  497. block which is filled by the MLC.  Its format  is  one  word  for
  498.  
  499. each  character  input.   The  low  order byte of the word is the
  500.  
  501. character and the high order byte is the  line  number  that  the
  502.  
  503. character came in on.
  504.  
  505.  
  506.      When the block is  received  it  is  passed  to  the  Telnet
  507.  
  508. module.   This  module   takes  the  characters out and processes
  509.  
  510. them.  As this is happening another block is being filled by  the
  511.  
  512. MLC.
  513.  
  514.  
  515.  
  516.  
  517. 2.2.1  Telnet Module
  518.  
  519.  
  520.      When the Telnet Module gets a character for a port, it first
  521.  
  522. checks  if there is an open connection for that port.  If not, it
  523.  
  524. discards the character and outputs a bell character to the  port.
  525.  
  526.  
  527.  
  528.                                -7-
  529.  
  530. IEN-166                                                 R. Hinden
  531.                                      Bolt Beranek and Newman Inc.
  532.                                                      January 1981
  533.  
  534.  
  535.  
  536. Next,  it  checks to see if there is room in the MBLK for another
  537.  
  538. character.  If not, then the character is discarded and the  bell
  539.  
  540. rung.   If  there is room, the character is put into the MBLK and
  541.  
  542. the proper pointers are advanced.  Telnet then indicates  to  the
  543.  
  544. next  protocol  module  that there is data to send.  Depending on
  545.  
  546. which protocol is being used for the connection, this  is  either
  547.  
  548. the NCP or TCP module.
  549.  
  550.  
  551.  
  552.  
  553. 2.2.2  TCP Module
  554.  
  555.  
  556.      When the TCP module gets a signal that  there  is  new  data
  557.  
  558. that  should  be  sent,  it  first checks if there is room in the
  559.  
  560. sending window to send more data.  This done by checking  if  the
  561.  
  562. last  sent  but  unacknowledged  data is at the right edge of the
  563.  
  564. sending window.  If there is no room, then nothing will be  sent.
  565.  
  566. Otherwise, the TCP module will adjust the pointers in the PDB and
  567.  
  568. MBLKs to point to the correct data and update the TCP header.
  569.  
  570.  
  571.      Flow control in the sending direction is done by maintaining
  572.  
  573. three  pointers  in  the  PDB.  These are pointers to data in the
  574.  
  575. MBLKs.  They are pointers to the last ACKed character,  the  last
  576.  
  577. sent  but  unACKed character, and the last not-yet-sent character
  578.  
  579. in the MBLK.  As data is ACKed, sent, or put into the  MBLK,  the
  580.  
  581. appropriate pointer is advanced.
  582.  
  583.  
  584.  
  585.  
  586.  
  587.                                -8-
  588.  
  589. IEN-166                                                 R. Hinden
  590.                                      Bolt Beranek and Newman Inc.
  591.                                                      January 1981
  592.  
  593.  
  594.  
  595.      When the TCP module is ready to send the data, it checks  to
  596.  
  597. see  if  the  1822  module can send the data (i.e., there are not
  598.  
  599. more than eight outstanding messages).  If the data can be  sent,
  600.  
  601. then  the  TCP module will compute a checksum for the message and
  602.  
  603. pass a PDB pointer to the IP module.
  604.  
  605.  
  606.  
  607.  
  608. 2.2.3  Internet Module
  609.  
  610.  
  611.      When the IP module gets a pointer to a PDB it  first  checks
  612.  
  613. to  see  if  it  knows  where  to  send  the  datagram.   If  the
  614.  
  615. destination is on the same  network  as  the  TAC,  the  Internet
  616.  
  617. module  will use that as the address.  If the destination is on a
  618.  
  619. different network, then it  will  send  it  to  a  gateway.   The
  620.  
  621. procedure  to  decide  which  gateway to use is discussed in more
  622.  
  623. detail in the section "Internet Protocol".
  624.  
  625.  
  626.      The IP module will then build an IP leader in the  MBLK  and
  627.  
  628. compute  the checksum of the leader.  It will then pass a pointer
  629.  
  630. to the message to the 1822 module.
  631.  
  632.  
  633.  
  634.  
  635. 2.2.4  1822 Module
  636.  
  637.  
  638.      When the 1822 module gets a pointer to a PDB, it will always
  639.  
  640. send  the message it contains to the destination specified in the
  641.  
  642. PDB.  The destination host will either be  a  server  host  or  a
  643.  
  644.  
  645.  
  646.                                -9-
  647.  
  648. IEN-166                                                 R. Hinden
  649.                                      Bolt Beranek and Newman Inc.
  650.                                                      January 1981
  651.  
  652.  
  653.  
  654. gateway.   The  1822  module  will  keep  track  of the number of
  655.  
  656. outstanding (no RFNMs received) messages sent to  a  host.   This
  657.  
  658. will  be  used by the NCP and TCP protocol modules to insure that
  659.  
  660. the IMP will never block the TAC's host interface due  to  having
  661.  
  662. more than eight outstanding messages.
  663.  
  664.  
  665.      When the 1822 module sends the message,  it  will  build  an
  666.  
  667. 1822  leader  in  the MBLK.  It will then send the message to the
  668.  
  669. IMP via the host interface hardware.
  670.  
  671.  
  672.  
  673.  
  674. 3.  Control and Priority
  675.  
  676.  
  677.      The code in the TAC will run either at the  interrupt  level
  678.  
  679. or  at  the background loop.  The interrupt routines will support
  680.  
  681. the host interface, MLC, and clock.  In addition,  high  priority
  682.  
  683. protocol routines will run at the task interrupt level.
  684.  
  685.  
  686.      The background loop will contain most of the TAC code.   The
  687.  
  688. protocol  modules  will  run  here.  They will be executed in the
  689.  
  690. following order:  1822 Input, IP Input,  TCP  Input,  NCP  Input,
  691.  
  692. Telnet  Input,  Telnet Output, NCP Output, TCP Output, IP Output,
  693.  
  694. and 1822 Output.
  695.  
  696.  
  697.      Each protocol module will have  an  input  queue.   When  it
  698.  
  699. runs,  it  checks  for  an  entry  on  its  queue.   If  it finds
  700.  
  701. something, it takes it off the queue and processes it.   Some  of
  702.  
  703.  
  704.  
  705.                               -10-
  706.  
  707. IEN-166                                                 R. Hinden
  708.                                      Bolt Beranek and Newman Inc.
  709.                                                      January 1981
  710.  
  711.  
  712.  
  713. the  protocol  modules  will be written to process all entries on
  714.  
  715. their queue before exiting; others will  process  one  entry  and
  716.  
  717. then  exit.   The  NCP,  TCP, and Telnet modules will process one
  718.  
  719. entry.  The 1822 and IP modules will process all entries.
  720.  
  721.  
  722.  
  723.  
  724. 4.  Data Structures
  725.  
  726.  
  727.      A new system of  buffers  will  be  used  in  the  TAC.   It
  728.  
  729. consists  of  two  types  of blocks, the Message Block (MBLK) and
  730.  
  731. Protocol Data Block (PDB).  These are used both for receiving and
  732.  
  733. transmitting  messages  and for buffering characters on input and
  734.  
  735. output.
  736.  
  737.  
  738.      The structure of these buffers is such that when a  protocol
  739.  
  740. module  is  passed a message it is given a pointer to a PDB.  The
  741.  
  742. PDB includes a link to the first MBLK.  The main function of  the
  743.  
  744. PDB  is  to save frequently accessed things in the message and to
  745.  
  746. point to the message.  The MBLKs  contain  the  actual  message.
  747.  
  748. They also have fields to facilitate reassembly and sequencing.
  749.  
  750.  
  751.  
  752.  
  753. 4.1  Message Block
  754.  
  755.  
  756.      The main function of the Message Block  (MBLK)  is  to  hold
  757.  
  758. messages.   It will be used for all protocols.  If a message will
  759.  
  760. not fit in one MBLK, then the remainder will be put into a second
  761.  
  762.  
  763.  
  764.                               -11-
  765.  
  766. IEN-166                                                 R. Hinden
  767.                                      Bolt Beranek and Newman Inc.
  768.                                                      January 1981
  769.  
  770.  
  771.  
  772. MBLK.  The second will be linked to the first.  The length of the
  773.  
  774. MBLK will be either 30 or 60 words.  The 30 word MBLK is used for
  775.  
  776. sending data and the 60 word MBLK is used for receiving.
  777.  
  778.  
  779.      The header of the MBLK consists of 4 words.   See  Figure  2
  780.  
  781. for  the  format  of  the  block.  The "Link" is used to point to
  782.  
  783. other MBLKs.  The "Offset" field  is  used  for  reassembling  IP
  784.  
  785. fragments  and  sequencing  TCP data.  During these operations it
  786.  
  787. contains the offset of where this data is relative to the data in
  788.  
  789. the  previous  MBLK.   Zero  means that there is no missing data.
  790.  
  791. This is discussed in detail in the section on "Reassembly".
  792.  
  793.  
  794.       1             0 0             0
  795.       5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  796.      +---------------+---------------+
  797.   0  |             Link              |  Pointer to next MBLK
  798.      +---------------+---------------+
  799.   1  |             Offset            |  Used in reassembly and sequencing
  800.      +---------------+---------------+
  801.   2  |    Length     |   Flags       |  Length of Data, Bit flags
  802.      +---------------+---------------+
  803.   3  |       Pointer to Data         |  Pointer to current data
  804.      +---------------+---------------+
  805.   4  |                               |  Area which holds message
  806.   .  |       Data                    |
  807.   .  |                               |
  808.   .  |            Area               |
  809.      |                               |
  810.   n* |                               |
  811.      +---------------+---------------+
  812.  
  813.                  Figure 2 . Message Block Format
  814.  
  815.  
  816.  
  817. _______________
  818. * Where "n" is either 29 or 59, depending whether  the  block  is
  819. used for sending or receiving.
  820.  
  821.  
  822.  
  823.                               -12-
  824.  
  825. IEN-166                                                 R. Hinden
  826.                                      Bolt Beranek and Newman Inc.
  827.                                                      January 1981
  828.  
  829.  
  830.  
  831.      The "Length" and  "Pointer  to  Data"  fields  are  used  to
  832.  
  833. indicate  where and how much data is in the MBLK.  The meaning of
  834.  
  835. these  is  always  relative  to  the  protocol  module  currently
  836.  
  837. processing  the message.  For example:  when a message is read in
  838.  
  839. from the host interface the "Pointer to Data" will point  to  the
  840.  
  841. 1822  leader  and the "Length" will be the length of all the data
  842.  
  843. in this MBLK.  When the 1822 module is ready to pass the data  to
  844.  
  845. the next protocol module, it adjusts these fields to refer to the
  846.  
  847. data after the 1822 leader.  In this way, a protocol module  need
  848.  
  849. not know what, if any, protocol preceded it.
  850.  
  851.  
  852.      The "Flags" is a bit field containing such things as End  of
  853.  
  854. message,  I/O  in  progress, Read or Write, small or large block,
  855.  
  856. etc.  The "Data Area" is where the actual message is stored.  The
  857.  
  858. small  size  MBLK (30 words) is sized to contain an 1822, IP, and
  859.  
  860. TCP leader, but no data.  The large size (60 words)  can  contain
  861.  
  862. the leaders plus up to 60 bytes of data.
  863.  
  864.  
  865.  
  866.  
  867. 4.2  Protocol Data Block
  868.  
  869.  
  870.      The Protocol Data Block is a header block for  one  or  more
  871.  
  872. MBLKs  that make up a message.  It contains pointers to the first
  873.  
  874. MBLK, pointers to  specific  leaders  in  the  MBLKs,  frequently
  875.  
  876. accessed items from the message, and a link to the next PDB.
  877.  
  878.  
  879.  
  880.  
  881.  
  882.                               -13-
  883.  
  884. IEN-166                                                 R. Hinden
  885.                                      Bolt Beranek and Newman Inc.
  886.                                                      January 1981
  887.  
  888.  
  889.  
  890.      As previously stated, it is pointers to PDBs that are passed
  891.  
  892. between  protocol modules.  When a protocol module gets a PDB, it
  893.  
  894. expects to find one PDB, which points to one or more MBLKs.   The
  895.  
  896. data  in  the  MBLKs  is  expected  to  be  in  sequence and non-
  897.  
  898. fragmented.  This requires that each protocol module insure  that
  899.  
  900. the  data  it  passes  to the next module be contiguous.  This is
  901.  
  902. best described with the following example:
  903.  
  904.  
  905.      When the Internet module gets  two  fragments  of  the  same
  906.  
  907. datagram,  it needs to reassemble them before it can pass them to
  908.  
  909. the next protocol module.  What it does  is  to  take  the  MBLKs
  910.  
  911. containing  the  second  fragment  and  link them into the proper
  912.  
  913. places in the list of MBLKs of the first fragment.   As  it  does
  914.  
  915. this,  it adjusts the fields in the MBLKs to point to the correct
  916.  
  917. data.  When it has linked  in  all  the  MBLKs  from  the  second
  918.  
  919. fragment,  it puts the PDB, which controlled the second fragment,
  920.  
  921. back on the free list of PDBs.
  922.  
  923.  
  924.      The TCP module performs a similar operation to sequence  the
  925.  
  926. data before it passes it to the Telnet module.  The format of the
  927.  
  928. PDB is shown in Figure 3.
  929.  
  930.  
  931.      The first field in the PDB, "Link to next PDB", is a pointer
  932.  
  933. to another PDB.  This is used for reassembly and sequencing.  The
  934.  
  935. next field in the PDB is the address field.  This is  either  the
  936.  
  937. source of the message if it was received or the destination if it
  938.  
  939.  
  940.  
  941.                               -14-
  942.  
  943. IEN-166                                                 R. Hinden
  944.                                      Bolt Beranek and Newman Inc.
  945.                                                      January 1981
  946.  
  947.  
  948.  
  949.  
  950.  
  951.       1             0 0             0
  952.       5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  953.      +---------------+---------------+
  954.    0 |    Link to next PDB           |  Pointer to next PDB
  955.      +---------------+---------------+
  956.    1 |   Network     |   Host        |  Source / Destination
  957.      +---------------+---------------+  Address
  958.    2 |               |   IMP         |
  959.      +---------------+---------------+
  960.    3 |        Identification         |  IP Identification
  961.      +---------------+---------------+
  962.    4 |     Flags     |   Protocol    |  Bit flags, Protocol #
  963.      +---------------+---------------+
  964.    5 |          Time Stamp           |  Time stamp for aging
  965.      +---------------+---------------+
  966.    6 |    Pointer to 1st Leader      |  Usually 1822
  967.      +---------------+---------------+
  968.    7 |    Pointer to 2nd Leader      |  Usually IP or NCP
  969.      +---------------+---------------+
  970.    8 |    Pointer to 3rd Leader      |  Usually TCP
  971.      +---------------+---------------+
  972.    9 |    Pointer to first MBLK      |  Pointer to first MBLK
  973.      +---------------+---------------+
  974.   10 |    Protocol                   |  Variables used by each
  975.      +                               +  protocol module
  976.   11 |      Variables                |
  977.      +                               +
  978.   12 |         Area                  |
  979.      +                               +
  980.   13 |                               |
  981.      +---------------+---------------+
  982.  
  983.  
  984.               Figure 3 . Protocol Data Block Format
  985.  
  986.  
  987. is to be  sent.   The  "Identification"  field  is  the  internet
  988.  
  989. identification  which  is  used in assembling internet fragments.
  990.  
  991. The "Flags" field is a bit array used for  things  like  datagram
  992.  
  993. complete,  EOL,  Urgent, Read or Write, block free, in use, hole,
  994.  
  995. etc.  The "Protocol"  field  is  the  host-to-host  protocol  the
  996.  
  997.  
  998.  
  999.  
  1000.                               -15-
  1001.  
  1002. IEN-166                                                 R. Hinden
  1003.                                      Bolt Beranek and Newman Inc.
  1004.                                                      January 1981
  1005.  
  1006.  
  1007.  
  1008. message  is  for.   The "Time Stamp" field is used for timing out
  1009.  
  1010. messages.
  1011.  
  1012.  
  1013.      The "Pointer Leader" fields are used to point  to  different
  1014.  
  1015. leaders  in  the MBLKs.  This is done to make it easier to find a
  1016.  
  1017. particular  leader  in  the  message.   They  are  set  up  by  a
  1018.  
  1019. particular  protocol  message  and  refer  to  different  leaders
  1020.  
  1021. depending on which protocols are in use.
  1022.  
  1023.  
  1024.      The "Pointer to first MBLK" field  is  the  pointer  to  the
  1025.  
  1026. first  MBLK  of  the message.  The "Protocol Variables Area" is a
  1027.  
  1028. temporary area that any protocol  module  can  use  while  it  is
  1029.  
  1030. processing  the  PDB.   As  long as it controls the PDB, no other
  1031.  
  1032. module will change these fields.
  1033.  
  1034.  
  1035.  
  1036.  
  1037. 5.  1822 Protocol
  1038.  
  1039.  
  1040.      All 1822 data messages will be passed directly to  the  next
  1041.  
  1042. protocol  module.  When the 1822 module gets a control message it
  1043.  
  1044. will call a routine supplied to it by the next  protocol  module.
  1045.  
  1046. For  example,  the  NCP module will supply a routine to be called
  1047.  
  1048. when the 1822 module receives a "RFNM" on  an  NCP  link  number.
  1049.  
  1050. The  routines  will  be  called  with a pointer to the PDB of the
  1051.  
  1052. message.  When the routine returns the 1822 module  will  discard
  1053.  
  1054. the message.
  1055.  
  1056.  
  1057.  
  1058.  
  1059.                               -16-
  1060.  
  1061. IEN-166                                                 R. Hinden
  1062.                                      Bolt Beranek and Newman Inc.
  1063.                                                      January 1981
  1064.  
  1065.  
  1066.  
  1067. 6.  Internet Protocol
  1068.  
  1069.  
  1070. 6.1  Identifier Assignment
  1071.  
  1072.  
  1073.      When  the  Internet  module  gets  a  message  to  send,  it
  1074.  
  1075. generates a value for the "Identifier" (ID) field in the internet
  1076.  
  1077. header.  It does this by keeping a 16-bit counter called  the  ID
  1078.  
  1079. counter.   When it needs a new value it increments the counter by
  1080.  
  1081. one and uses the result.  The ID counter will not be  initialized
  1082.  
  1083. when  the TAC is reloaded or restarted, to insure that the values
  1084.  
  1085. are sequential.
  1086.  
  1087.  
  1088.  
  1089.  
  1090. 6.2  Option Support
  1091.  
  1092.  
  1093.      The Internet module will only actively  support  the  "Error
  1094.  
  1095. Report"  IP  option.  None of the other currently defined options
  1096.  
  1097. will require any action to be performed by the TAC.
  1098.  
  1099.  
  1100.  
  1101.  
  1102. 6.3  Reassembly
  1103.  
  1104.  
  1105.      When the Internet module gets a  PDB  which  is  a  datagram
  1106.  
  1107. fragment, it must reassemble it.  It first looks at the fragments
  1108.  
  1109. on the Internet-Reassembly queue to see if there  are  any  other
  1110.  
  1111. fragments  of  the  same datagram.  It does this by comparing the
  1112.  
  1113. source address, ID, and protocol number of the two fragments.  If
  1114.  
  1115.  
  1116.  
  1117.  
  1118.                               -17-
  1119.  
  1120. IEN-166                                                 R. Hinden
  1121.                                      Bolt Beranek and Newman Inc.
  1122.                                                      January 1981
  1123.  
  1124.  
  1125.  
  1126. it  does  not find a match, it adds the new PDB to the queue.  At
  1127.  
  1128. this point, it also puts a time stamp in the PDB.  This  will  be
  1129.  
  1130. used to timeout unassembled fragments.
  1131.  
  1132.  
  1133.      The actual reassembly process consists of adding  the  MBLKs
  1134.  
  1135. of  the  new datagram to the list of MBLKs of the datagram on the
  1136.  
  1137. queue.  This  is  done  using  the  "Offset",  "Length"  and  the
  1138.  
  1139. "Pointer  to  Data"  fields  in  the  MBLK.  At this point in the
  1140.  
  1141. processing of the fragment, the fragment consists of one or  more
  1142.  
  1143. MBLKs linked together.  The IP header will always be in the first
  1144.  
  1145. MBLK.  The "Offset" fields in the MBLKs are all zero (there is no
  1146.  
  1147. missing  data  in  the new fragment itself).  The "Length" fields
  1148.  
  1149. contain the length of the IP data (not including the  IP  header)
  1150.  
  1151. in  each MBLK.  The "Pointer to Data" fields point to the IP data
  1152.  
  1153. in each MBLK.
  1154.  
  1155.  
  1156.      The MBLKs of the new datagram are added to the  datagram  on
  1157.  
  1158. the  queue by comparing the "Fragment Offset" in the IP header of
  1159.  
  1160. the new datagram to the "Fragment Offset" in the IP header of the
  1161.  
  1162. datagram  on  the  reassembly  queue.  This is done by taking the
  1163.  
  1164. first MBLK on the list and adding the "Fragment Offset" from  the
  1165.  
  1166. IP  header to the "Length" and "Offset" fields in the first MBLK.
  1167.  
  1168. If this sum is greater than  the  "Fragment  Offset"  in  the  IP
  1169.  
  1170. header  of  the  new datagram, then the MBLKs of the new datagram
  1171.  
  1172. should go before the first MBLK of the datagram in  the  original
  1173.  
  1174.  
  1175.  
  1176.  
  1177.                               -18-
  1178.  
  1179. IEN-166                                                 R. Hinden
  1180.                                      Bolt Beranek and Newman Inc.
  1181.                                                      January 1981
  1182.  
  1183.  
  1184.  
  1185. fragment.   If  not, then they should be added in after.  In this
  1186.  
  1187. case,  the comparative process is repeated with the rest  of  the
  1188.  
  1189. MBLKs on the list.  When the proper place is found, the new MBLKs
  1190.  
  1191. are linked in and the  fields  of  the  new  and  old  MBLKs  are
  1192.  
  1193. adjusted.   If  the  new  fragment overlaps the existing, then by
  1194.  
  1195. adjusting the "Pointer to Data" and "Length" fields, the  overlap
  1196.  
  1197. can  be  skipped.   This  may  result  in one or more MBLKs being
  1198.  
  1199. discarded.
  1200.  
  1201.  
  1202.      When the datagram is completely reassembled, it can then  be
  1203.  
  1204. taken  off  the  Reassembly queue and passed to the next protocol
  1205.  
  1206. module.
  1207.  
  1208.  
  1209.  
  1210.  
  1211. 6.4  Routing
  1212.  
  1213.  
  1214.      The decision about where to send a datagram is twofold.   If
  1215.  
  1216. the  destination  host  is  on  the same net as the TAC, then the
  1217.  
  1218. datagram is sent directly to that host.  If not, then it must  be
  1219.  
  1220. sent to a gateway.
  1221.  
  1222.  
  1223.      The  Internet  module  will  maintain  a  table  that   will
  1224.  
  1225. facilitate  routing  messages  to  hosts  on other networks.  The
  1226.  
  1227. table is a list of all networks (256) and the gateways to get  to
  1228.  
  1229. the networks.  This table, called the Network-Gateway table, will
  1230.  
  1231. be  initially  loaded  into  the  TAC  and  will  be  dynamically
  1232.  
  1233.  
  1234.  
  1235.  
  1236.                               -19-
  1237.  
  1238. IEN-166                                                 R. Hinden
  1239.                                      Bolt Beranek and Newman Inc.
  1240.                                                      January 1981
  1241.  
  1242.  
  1243.  
  1244. maintained by the TAC.
  1245.  
  1246.  
  1247.      When the Internet module needs to find an address, it  looks
  1248.  
  1249. in  the  Network-Gateway table to get the gateway address for the
  1250.  
  1251. network it wants to send to.  If it finds an address it uses it.
  1252.  
  1253. If  the entry for the network it wants is empty (i.e., no gateway
  1254.  
  1255. address  specified),  then  the  Internet  module  will  use   an
  1256.  
  1257. arbitrary gateway.
  1258.  
  1259.  
  1260.      If the Internet module receives a Redirect  message  from  a
  1261.  
  1262. gateway, it will update the Network-Gateway table to indicate the
  1263.  
  1264. correct gateway.  This will insure that the Network-Gateway table
  1265.  
  1266. contains current information.
  1267.  
  1268.  
  1269.      If a gateway goes down  during  a  connection  the  Internet
  1270.  
  1271. module  will  clear  that  network's entry in the Network-Gateway
  1272.  
  1273. table.  It will then try an arbitrary gateway.   If  at  a  later
  1274.  
  1275. time,  the Internet module receives a Redirect message telling it
  1276.  
  1277. to use a new gateway to get  to  a  network,  it  will  set  that
  1278.  
  1279. network's  entry  in  Network-Gateway  table to the new gateway's
  1280.  
  1281. address.
  1282.  
  1283.  
  1284.  
  1285.  
  1286. 6.5  Gateway to Gateway Messages
  1287.  
  1288.  
  1289.      The Internet module will support the  "Gateway  to  Gateway"
  1290.  
  1291. protocol  in  a  passive  sense.   If  it receives a "Destination
  1292.  
  1293.  
  1294.  
  1295.                               -20-
  1296.  
  1297. IEN-166                                                 R. Hinden
  1298.                                      Bolt Beranek and Newman Inc.
  1299.                                                      January 1981
  1300.  
  1301.  
  1302.  
  1303. Unreachable  Packet"  or  a  "Redirect  Packet"  it   will   take
  1304.  
  1305. appropriate  action.   If  it  receives  anything  else,  it will
  1306.  
  1307. discard the message.   In  particular,  if  the  Internet  module
  1308.  
  1309. receives  a  "Source  Quench Packet" it will discard the message.
  1310.  
  1311. This strategy  is  used  due  to  the  TAC's  limited  amount  of
  1312.  
  1313. buffering.   The  buffers  would soon fill up because of the data
  1314.  
  1315. not being acknowledged (in TCP).  This will effectively limit the
  1316.  
  1317. transmission.
  1318.  
  1319.  
  1320.  
  1321.  
  1322. 6.6  Timeouts
  1323.  
  1324.  
  1325.      Internet  fragments  will  be  discarded  if  they  are  not
  1326.  
  1327. reassembled   within   60   seconds.   When  a  new  fragment  is
  1328.  
  1329. reassembled into an existing one, the "Timeout" field in  PDB  of
  1330.  
  1331. the  existing  fragment  will  be  updated with the current time.
  1332.  
  1333. This will, in effect, reset the timer for that fragment.
  1334.  
  1335.  
  1336.  
  1337.  
  1338. 7.  Transmission Control Protocol
  1339.  
  1340.  
  1341. 7.1  Connection Opening and Closing
  1342.  
  1343.  
  1344.      The TCP module will have a finite state machine  which  will
  1345.  
  1346. be  used for establishing and closing connections.  The procedure
  1347.  
  1348. to  open  a  connection  is  to  pass  the  required  information
  1349.  
  1350. (Destination  address,  socket, etc.) to the TCP module.  It will
  1351.  
  1352.  
  1353.  
  1354.                               -21-
  1355.  
  1356. IEN-166                                                 R. Hinden
  1357.                                      Bolt Beranek and Newman Inc.
  1358.                                                      January 1981
  1359.  
  1360.  
  1361.  
  1362. then run the finite state machine, which will set up the required
  1363.  
  1364. data  structures and open the connection.  Closing the connection
  1365.  
  1366. will be done in a similar way.  The states of  the  finite  state
  1367.  
  1368. machine  will  be  similar  to what is described in "IEN-129, DOD
  1369.  
  1370. Standard Transmission Control Protocol".
  1371.  
  1372.  
  1373.      All TCP Port numbers assigned by the TAC will consist of the
  1374.  
  1375. upper  8  bits  set to the terminal number for the connection (1-
  1376.  
  1377. 64.) and the lower 8 bits set to 23.  All connections made to  or
  1378.  
  1379. from the TAC will use this format.
  1380.  
  1381.  
  1382.  
  1383.  
  1384. 7.2  Initial Sequence Number Assignment
  1385.  
  1386.  
  1387.      The TCP module will maintain a 32-bit counter that  will  be
  1388.  
  1389. used  to  generate  Initial  Sequence Numbers (ISN).  The counter
  1390.  
  1391. will be incremented by a constant  value  every  time  the  H-316
  1392.  
  1393. clock  ticks,  which  is  every  25.6MS.   The  counter  will  be
  1394.  
  1395. incremented by 64.  This  will  then  wrap  around  approximately
  1396.  
  1397. every  4.55 hours.  When the TCP module needs an ISN it reads the
  1398.  
  1399. counter and gets a value.
  1400.  
  1401.  
  1402.  
  1403.  
  1404. 7.3  Option Support
  1405.  
  1406.  
  1407.      The TCP  module  will  understand  the  format  of  all  TCP
  1408.  
  1409. options.   It  will support the "No-Operation" and "End of Option
  1410.  
  1411.  
  1412.  
  1413.                               -22-
  1414.  
  1415. IEN-166                                                 R. Hinden
  1416.                                      Bolt Beranek and Newman Inc.
  1417.                                                      January 1981
  1418.  
  1419.  
  1420.  
  1421. List" options.  It will not support the "Buffer Size" option.  If
  1422.  
  1423. it  receives  a  "Buffer  Size" option with anything greater than
  1424.  
  1425. size one, it will not accept the connection but will reset it.
  1426.  
  1427.  
  1428.  
  1429.  
  1430. 7.4  Urgent Data
  1431.  
  1432.  
  1433.      When the TCP module receives a message with a  valid  Urgent
  1434.  
  1435. Pointer,  it  sets  a bit in the "Flag" word in the PDB and saves
  1436.  
  1437. the offset to the end of the urgent data.  When the next protocol
  1438.  
  1439. module  takes data out of the MBLK it will get an indication that
  1440.  
  1441. the data it is getting is urgent.
  1442.  
  1443.  
  1444.      Likewise, when the TCP module is given  data  to  send,  the
  1445.  
  1446. protocol module supplying the data can include an indication that
  1447.  
  1448. the data is urgent.  The TCP module will include this information
  1449.  
  1450. in all messages it sends until the urgent data is sent.
  1451.  
  1452.  
  1453.  
  1454.  
  1455. 7.5  End of Letter Handling
  1456.  
  1457.  
  1458.      The TCP module will not do anything special when it receives
  1459.  
  1460. a  message  with  End of Letter (EOL) set.  The TCP module always
  1461.  
  1462. presents all data to the next protocol module as soon  as  it  is
  1463.  
  1464. available.  Consequently, no special handling is necessary.
  1465.  
  1466.  
  1467.  
  1468.  
  1469.  
  1470.  
  1471.  
  1472.                               -23-
  1473.  
  1474. IEN-166                                                 R. Hinden
  1475.                                      Bolt Beranek and Newman Inc.
  1476.                                                      January 1981
  1477.  
  1478.  
  1479.  
  1480.      The TCP module will accept data  to  be  sent  with  an  EOL
  1481.  
  1482. indication.   It will send this data with EOL set in the message.
  1483.  
  1484. No additional data will be sent in the message.  If the  data  is
  1485.  
  1486. required  to  be  retransmitted,  it will be transmitted with EOL
  1487.  
  1488. preserved.
  1489.  
  1490.  
  1491.  
  1492.  
  1493. 7.6  Retransmissions
  1494.  
  1495.  
  1496.      Data that is transmitted by the  TCP  module  will  be  held
  1497.  
  1498. until  it  has  been  ACKed by the remote host.  If an ACK is not
  1499.  
  1500. received  for  the  data  within  three  seconds   it   will   be
  1501.  
  1502. retransmitted.   All data in the buffer that is not ACKed will be
  1503.  
  1504. retransmitted (except if EOL is set; see previous  section).   If
  1505.  
  1506. the   data   is  still  not  ACKed  for  another  seven  seconds,
  1507.  
  1508. retransmission will occur again.  This  procedure  will  continue
  1509.  
  1510. using  the  series 3,7,15,15,30 .  If there is still no ACK, then
  1511.  
  1512. the user will be notified.   The  retransmissions  will  continue
  1513.  
  1514. every  30  seconds until either the user closes the connection or
  1515.  
  1516. the TCP module receives an ACK.
  1517.  
  1518.  
  1519.  
  1520.  
  1521. 7.7  Acknowledgement and Window Strategy
  1522.  
  1523.  
  1524.      The Acknowledgement (ACK) and Window parameters are used  to
  1525.  
  1526. control  how  much data the remote host can send to the TAC.  The
  1527.  
  1528.  
  1529.  
  1530.  
  1531.                               -24-
  1532.  
  1533. IEN-166                                                 R. Hinden
  1534.                                      Bolt Beranek and Newman Inc.
  1535.                                                      January 1981
  1536.  
  1537.  
  1538.  
  1539. TCP module will ACK data up to the limit it is willing to  buffer
  1540.  
  1541. for a connection.  Data received after this limit is reached will
  1542.  
  1543. be discarded.  As the data  is  received,  but  before  the  next
  1544.  
  1545. protocol  module  takes  it out of the buffer, the window will be
  1546.  
  1547. closed by the amount received.  When the buffer limit is reached,
  1548.  
  1549. the  TCP module will not ACK any new data and will be advertising
  1550.  
  1551. a zero window.  When the next protocol module takes data  out  of
  1552.  
  1553. the  buffer,  the  window  will  be  opened.  This will allow the
  1554.  
  1555. remote host to send more data.
  1556.  
  1557.  
  1558.      When data is sent on the connection,  the  current  ACK  and
  1559.  
  1560. Window  values  are  always included in the same message.  In the
  1561.  
  1562. case where no data is being sent and the ACK and/or Window values
  1563.  
  1564. have changed, a different strategy is used.  When the ACK pointer
  1565.  
  1566. is advanced, the TCP module will wait one second to see if  there
  1567.  
  1568. is  data to send.  If there has been no data sent for one second,
  1569.  
  1570. then the ACK will be sent without data.  A new window value  will
  1571.  
  1572. not  be  sent  until  the  buffer  is  at least half empty.  This
  1573.  
  1574. strategy is designed to insure that the remote host sends  blocks
  1575.  
  1576. of data and to eliminate unnecessary retransmissions.
  1577.  
  1578.  
  1579.  
  1580.  
  1581. 7.8  Sequencing
  1582.  
  1583.  
  1584.      When the TCP module gets a data message for a connection, it
  1585.  
  1586. must  insure that the data is sequenced before it passes the data
  1587.  
  1588.  
  1589.  
  1590.                               -25-
  1591.  
  1592. IEN-166                                                 R. Hinden
  1593.                                      Bolt Beranek and Newman Inc.
  1594.                                                      January 1981
  1595.  
  1596.  
  1597.  
  1598. to the next protocol module.  The sequencing is done by comparing
  1599.  
  1600. the  sequence  number  of the message to the current "Left Window
  1601.  
  1602. Edge" (LWE) and  manipulation  of  the  "offset",  "length",  and
  1603.  
  1604. "pointer  to  data" fields of the MBLKs that make up the message.
  1605.  
  1606. For each connection a list is maintained of MBLKs that are  being
  1607.  
  1608. sequenced.  The MBLKs are in order but there may be missing data.
  1609.  
  1610.  
  1611.      When the TCP module is  ready  to  sequence  the  data,  the
  1612.  
  1613. message  consists  of a PDB, followed by one or more MBLKs linked
  1614.  
  1615. together.  The "pointer to data" field points to the  actual  TCP
  1616.  
  1617. data.   The  "offset" fields are all zero because the data in the
  1618.  
  1619. message is sequential relative to itself.  The "length" field  is
  1620.  
  1621. the amount of data in each MBLK.
  1622.  
  1623.  
  1624.      The sequencing is done by  linking  the  MBLKs  of  the  new
  1625.  
  1626. message into the sequencing list for the connection for which the
  1627.  
  1628. data message is intended.  This is done via the following steps:
  1629.  
  1630.  
  1631.      1.  Subtract  the  LWE  from  the  Sequence  number  of  the
  1632.          message.   The  result is the offset from the LWE.  Then
  1633.          set the "offset" field of the first MBLK to this result.
  1634.          If it is zero, this means that there is no missing data.
  1635.          Otherwise, the result is the amount of missing data.
  1636.  
  1637.      2.  Add the MBLKs to the existing list.   If  there  are  no
  1638.          MBLKs  on  the list, then the new MBLKs become the list.
  1639.          Otherwise, the insertion is done in the following steps:
  1640.  
  1641.               a) Find the position in which to add the  new  MBLK
  1642.                  by  adding together the "offset" and "length" of
  1643.                  first MBLK in the list.  If "offset" of new MBLK
  1644.                  is  less  than  the  sum, then the new MBLK goes
  1645.                  before the MBLK in  the  list.   Otherwise,  add
  1646.  
  1647.  
  1648.  
  1649.                               -26-
  1650.  
  1651. IEN-166                                                 R. Hinden
  1652.                                      Bolt Beranek and Newman Inc.
  1653.                                                      January 1981
  1654.  
  1655.  
  1656.  
  1657.                  "offset"  and  "length"  of the next MBLK in the
  1658.                  list to the previous sum. Repeat this  procedure
  1659.                  until a fit is found or the end of list.
  1660.  
  1661.               b) Link the new MBLK into the list.
  1662.  
  1663.               c) Subtract  the  ("offset"  +  "length")  of   the
  1664.                  previous MBLK from "offset" of the new MBLK.
  1665.  
  1666.               d) Subtract the ("offset" + "length")  of  the  new
  1667.                  MBLK from "offset" of the next MBLK.
  1668.  
  1669.  
  1670. 0verlapping data will be handled by adjusting the "length"  field
  1671.  
  1672. in the MBLKs as the new MBLKs are linked in.
  1673.  
  1674.  
  1675.      The result of these operations is  a  list  of  MBLKs.   The
  1676.  
  1677. "offset"  field  in the MBLKs contains the number of missing data
  1678.  
  1679. bytes before it.  When the MBLK is at the front of  the  list,  a
  1680.  
  1681. zero  "offset"  means  the data is sequenced and can be passed to
  1682.  
  1683. the next protocol module.  As data is taken by the next  protocol
  1684.  
  1685. module,   the   "length"  field  of  the  first  MBLK  should  be
  1686.  
  1687. decremented.  When it is zero, the block  is  empty  and  can  be
  1688.  
  1689. discarded.
  1690.  
  1691.  
  1692.  
  1693.  
  1694.  
  1695.  
  1696.  
  1697.  
  1698.  
  1699.  
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.                               -27-
  1709.